<template>
	<z-paging ref="pagingRef" v-model="state.list" @query="queryList">
		<template #top>
			<hx-navbar title="优惠券"></hx-navbar>
		</template>
		<coupon-info :list="state.list" @handleSuccess="handleList"></coupon-info>
	</z-paging>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue';
import { getPage } from '@/api/promotion/couponInfo';
import CouponInfo from '@/components/coupon-info/index.vue';
const pagingRef = ref<ZPagingInstance>();
const state = reactive<{ list: Array<any> }>({
	list: [],
});
const queryList: ZPagingEvent.Query = (pageNo: number, pageSize: number) => {
	getPage({
		current: pageNo,
		size: pageSize,
		descs: 'create_time',
	}).then((response) => {
		pagingRef.value?.complete(response.data.records);
	});
};
const handleList = () => {
	pagingRef.value?.reload();
};
</script>

<style lang="scss"></style>
